package com.grass.p019lv.adapter;

import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.recyclerview.widget.RecyclerView;
import com.androidsa.bttsddka.R;
import com.androidx.p013lv.base.bean.VarietyBean;
import com.androidx.p013lv.base.glide.GlideUtils;
import com.androidx.p013lv.base.recycler.BaseRecyclerAdapter;
import com.androidx.p013lv.base.recycler.BaseRecyclerHolder;
import com.androidx.p013lv.base.utils.UiUtils;
import com.bumptech.glide.Glide;
import java.util.ArrayList;

/* renamed from: com.grass.lv.adapter.AdapterVariety */
public class AdapterVariety extends BaseRecyclerAdapter<VarietyBean, Holder> {
    private String domain;
    double height = ((double) (((UiUtils.getWindowWidth() - UiUtils.dp2px(24)) * 9) / 16));

    public AdapterVariety() {
        this.list = new ArrayList();
    }

    public void setDomain(String str) {
        this.domain = str;
    }

    public String getDomain() {
        return this.domain;
    }

    public void MyHolder(Holder holder, int i) {
        holder.setData((VarietyBean) this.list.get(i), i);
    }

    public void onViewRecycled(Holder holder) {
        super.onViewRecycled((RecyclerView.ViewHolder) holder);
        ImageView imageView = holder.iv_cover;
        if (imageView != null) {
            Glide.with(imageView.getContext()).clear(imageView);
        }
    }

    @Override // androidx.recyclerview.widget.RecyclerView.Adapter
    public Holder onCreateViewHolder(ViewGroup viewGroup, int i) {
        return new Holder(LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.item_variety, viewGroup, false));
    }

    /* access modifiers changed from: package-private */
    /* renamed from: com.grass.lv.adapter.AdapterVariety$Holder */
    public class Holder extends BaseRecyclerHolder {
        ImageView iv_cover;
        TextView tv_title;
        TextView tv_video_num;
        TextView tv_video_replace;

        public Holder(View view) {
            super(view);
            this.iv_cover = (ImageView) view.findViewById(R.id.iv_cover);
            this.tv_title = (TextView) view.findViewById(R.id.tv_title);
            ViewGroup.LayoutParams layoutParams = this.iv_cover.getLayoutParams();
            layoutParams.height = (int) AdapterVariety.this.height;
            this.iv_cover.setLayoutParams(layoutParams);
            this.tv_video_num = (TextView) view.findViewById(R.id.tv_video_num);
            this.tv_video_replace = (TextView) view.findViewById(R.id.tv_video_replace);
        }

        public void setData(VarietyBean varietyBean, int i) {
            if (TextUtils.isEmpty(varietyBean.getCoverImg())) {
                GlideUtils.loadCropRadiusDefault(4, this.iv_cover);
            } else {
                GlideUtils.loadCropRadius(AdapterVariety.this.domain + varietyBean.getCoverImg(), 4, this.iv_cover);
            }
            if (varietyBean.getNewVideoNum() > 0) {
                TextView textView = this.tv_video_num;
                textView.setText(varietyBean.getNewVideoNum() + "");
                this.tv_video_replace.setVisibility(0);
            } else {
                this.tv_video_num.setText("");
                this.tv_video_replace.setVisibility(8);
            }
            TextView textView2 = this.tv_title;
            textView2.setText(varietyBean.getChoiceTitle() + "");
        }
    }
}
